(function () {
  window.alert = function (str) {
    const shield = document.createElement('DIV');
    shield.id = 'shield';
    shield.style.position = 'absolute';
    shield.style.left = '50%';
    shield.style.top = '50%';
    shield.style.width = '280px';
    shield.style.height = '150px';
    shield.style.marginLeft = '-140px';
    shield.style.marginTop = '-110px';
    shield.style.zIndex = '25';
    const alertFram = document.createElement('DIV');
    alertFram.id = 'alertFram';
    alertFram.style.position = 'absolute';
    alertFram.style.width = '520px';
    alertFram.style.height = '150px';
    alertFram.style.left = '50%';
    alertFram.style.top = '50%';
    alertFram.style.marginLeft = '-140px';
    alertFram.style.marginTop = '-110px';
    alertFram.style.textAlign = 'center';
    alertFram.style.lineHeight = '150px';
    alertFram.style.zIndex = '300';
    let strHtml = '<ul style="list-style:none;margin:0px;padding:0px;width:100%">\n';
    strHtml +=
      ' <li style="background:#095CB5;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:40px;line-height:40px;border:1px solid #F9CADE;color:white">提示</li>\n';
    strHtml +=
      ' <li style="background:#2A303B;text-align:center;font-size:12px;height:0px;border-left:1px solid #F9CADE;border-right:1px solid #F9CADE;color:#DCC722">' +
      str +
      '</li>';
    strHtml +=
      ' <li style="background:#2A303B;text-align:center;font-size:12px;height:95px;line-height:75px;border-left:1px solid #F9CADE;border-right:1px solid #F9CADE;color:white;display: flex;justify-content: space-around;"><a href=' +
      window.g.googleBrowserThree +
      ' target=\'_blank\' style="color:white;text-decoration:underline">点击进入32位下载地址</a> <a href=' +
      window.g.googleBrowserSix +
      ' target=\'_blank\' style="color:white;text-decoration:underline">点击进入64位下载地址</a></li>';
    strHtml +=
      ' <li style="background:#095CB5;text-align:center;font-weight:bold;height:40px;line-height:40px; border:1px solid #F9CADE;"><input type="button" value="取 消" onclick="doOk()" style="width:80px;height:20px;background:#095CB5;color:white;border:1px solid white;font-size:14px;line-height:20px;outline:none;margin-top: 4px"/></li>\n';
    strHtml += '</ul>\n';
    alertFram.innerHTML = strHtml;
    document.body.appendChild(alertFram);
    document.body.appendChild(shield);
    this.doOk = function () {
      alertFram.style.display = 'none';
      shield.style.display = 'none';
    };
    alertFram.focus();
    document.body.onselectstart = function () {
      return false;
    };
  };
  // 获取谷歌浏览器版本
  function getChromeVersion() {
    const arr = navigator.userAgent.split(' ');
    let chromeVersion = '';
    for (let i = 0; i < arr.length; i++) {
      if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
    }
    if (chromeVersion) {
      return Number(chromeVersion.split('/')[1].split('.')[0]);
    } else {
      return false;
    }
  }
  // 判断是否为谷歌浏览器
  function browserVersionMessage() {
    if (getChromeVersion()) {
      const version = getChromeVersion();
      if (version < window.g.lowestVersion) {
        const msg =
          '您使用的谷歌浏览器版本过低，请点击上方地址将浏览器升级到' +
          window.g.lowestVersion +
          '版本以上！';
        alert(msg);
      }
    } else {
      alert('请使用谷歌浏览器');
    }
  }
  browserVersionMessage();
})();
